package sourceagile.server.gitFileRepository;

import java.io.File;

import org.codehaus.jettison.json.JSONArray;

import sourceagile.server.utilities.ConvertFileToJson;

public class ListGitFeatureFiles {

	public static JSONArray listEntries(String projectName) {

		JSONArray entries = new JSONArray();

		String projectFeaturesPath = System.getProperty("java.io.tmpdir")
				+ projectName + "/features";

		File featuresPath = new File(projectFeaturesPath);

		String[] children = featuresPath.list();

		for (int i = 0; i < children.length; i++) {

			entries.put(ConvertFileToJson.convertFeaturesFromGit("features",
					children[i]));
		}

		return entries;
	}

}
